package com.cxzl.pcxt.action.front;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cxzl.common.vo.JsonVo;
import com.cxzl.pcxt.entity.User;
import com.cxzl.pcxt.service.UserService;

/**
 * 注册控制器
 * 
 * @author DMJ
 *
 */
@Controller
public class RegAction {

	@Resource(name = "pxctUserService")
	private UserService userService;

	/**
	 * 注册页
	 * 
	 * @return
	 */
	@RequestMapping("regPage")
	public String regPage() {
		return "pcxt/mobile/reg";
	}

	/**
	 * 注册
	 * 
	 * @param user
	 * @return
	 */
	@ResponseBody
	@RequestMapping("reg.json")
	public JsonVo<String> reg(User user) {
		userService.addUser(user);
		JsonVo<String> json = new JsonVo<String>();
		json.setSuccess(true);
		json.setContent(null);
		return json;
	}
}
